layui.use(["form"],function () {
   var $=layui.jquery,form=layui.form ;
    var m = $('meta[name=\'_csrf\']').attr('content');
    var n = $('meta[name=\'_csrf_header\']').attr('content');
   form.on('select(fwdl)',function (data) {
       var id=data.value;
       if(""!=id){
           $.ajax({
               type: 'get',
               url: '/uc/gzms/ajax/fwfl?id='+id+"&timespace="+new Date(),
               dataType: 'json',
               async: false,
               beforeSend: function (xhr) {xhr.setRequestHeader(n, m)},
               contentType: 'application/json;charset=utf-8',
               error: function (request) {
                   console.log('Connection error')
               },
               success: function (data) {
                   if (data.state == 200) {
                       var dataList=data.dataList;
                       var html="<option value=''>--请选择分类--</option>";
                       if(null!=dataList&&dataList.length>0){
                           for (var i=0;i<dataList.length;i++){
                               html=html+"<option value='"+dataList[i].id+"'>"+dataList[i].fwfl+"</option>";
                           }
                       }
                       $("select[name='fwfl']").html(html);
                       form.render('select');
                   }
               }
           })
       }
   });
});
    